package conf

import "os"

type TesterConf struct {
	serverURL   string
	callbackURL string

	testKeyFile string
}

func NewTesterConfig(serURL string, callURL string, keyFile string) *TesterConf {
	return &TesterConf{
		serverURL:   serURL,
		callbackURL: callURL,
		testKeyFile: keyFile,
	}
}
func (tf *TesterConf) ServerURL() string {
	if tf.serverURL == "" {
		panic("empty url")
	}
	return tf.serverURL
}
func (tf *TesterConf) CallbackURL() string {
	if tf.callbackURL == "" {
		panic("empty callback")
	}

	return tf.callbackURL
}
func (tf *TesterConf) KeyFile() *os.File {
	file, err := os.OpenFile(tf.testKeyFile, os.O_CREATE|os.O_RDWR|os.O_APPEND, os.ModePerm)
	if err != nil {
		panic(err)
	}
	return file
}
